package com.entmanage.base.collegeco.service.impl;

import java.util.List;
import com.entmanage.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.entmanage.common.utils.SecurityUtils;
import com.entmanage.base.collegeco.mapper.CollegecoInternReportMapper;
import com.entmanage.base.collegeco.domain.CollegecoInternReport;
import com.entmanage.base.collegeco.service.ICollegecoInternReportService;

/**
 * 实习报告Service业务层处理
 *
 * @author lsq
 * @date 2025-08-06
 */
@Service
public class CollegecoInternReportServiceImpl implements ICollegecoInternReportService
{
    @Autowired
    private CollegecoInternReportMapper collegecoInternReportMapper;

    /**
     * 查询实习报告
     *
     * @param reportId 实习报告主键
     * @return 实习报告
     */
    @Override
    public CollegecoInternReport selectCollegecoInternReportByReportId(Long reportId)
    {
        return collegecoInternReportMapper.selectCollegecoInternReportByReportId(reportId);
    }

    /**
     * 查询实习报告列表
     *
     * @param collegecoInternReport 实习报告
     * @return 实习报告
     */
    @Override
    public List<CollegecoInternReport> selectCollegecoInternReportList(CollegecoInternReport collegecoInternReport)
    {
        return collegecoInternReportMapper.selectCollegecoInternReportList(collegecoInternReport);
    }

    /**
     * 新增实习报告
     *
     * @param collegecoInternReport 实习报告
     * @return 结果
     */
    @Override
    public int insertCollegecoInternReport(CollegecoInternReport collegecoInternReport)
    {
        // 保存用户和部门id
        collegecoInternReport.setUserId(SecurityUtils.getUserId());
        collegecoInternReport.setDeptId(SecurityUtils.getDeptId());
        collegecoInternReport.setCreateTime(DateUtils.getNowDate());
    collegecoInternReport.setCreateBy(SecurityUtils.getUsername());
        return collegecoInternReportMapper.insertCollegecoInternReport(collegecoInternReport);
    }

    /**
     * 修改实习报告
     *
     * @param collegecoInternReport 实习报告
     * @return 结果
     */
    @Override
    public int updateCollegecoInternReport(CollegecoInternReport collegecoInternReport)
    {
        collegecoInternReport.setUpdateTime(DateUtils.getNowDate());
    collegecoInternReport.setUpdateBy(SecurityUtils.getUsername());
        return collegecoInternReportMapper.updateCollegecoInternReport(collegecoInternReport);
    }

    /**
     * 批量删除实习报告
     *
     * @param reportIds 需要删除的实习报告主键
     * @return 结果
     */
    @Override
    public int deleteCollegecoInternReportByReportIds(Long[] reportIds)
    {
        return collegecoInternReportMapper.deleteCollegecoInternReportByReportIds(reportIds);
    }

    /**
     * 删除实习报告信息
     *
     * @param reportId 实习报告主键
     * @return 结果
     */
    @Override
    public int deleteCollegecoInternReportByReportId(Long reportId)
    {
        return collegecoInternReportMapper.deleteCollegecoInternReportByReportId(reportId);
    }
}
